package mirrormonkey.util.netevent.queue.tools;

import mirrormonkey.util.netevent.NetworkEvent;

/**
 * Used to test if events are called properly and if they are called in the
 * right order.
 * 
 * @author Philipp Christian Loewner
 * 
 */
public class MockEvent implements NetworkEvent {
	private static final int NOT_CALLED = -1;

	private static int nextCall = 0;

	public int callOrder = NOT_CALLED;

	@Override
	public void process() {
		callOrder = nextCall++;
	}

	public boolean wasCalled() {
		return callOrder != NOT_CALLED;
	}

	public static void reset(MockEvent[] events) {
		for (MockEvent e : events) {
			e.callOrder = NOT_CALLED;
		}
		nextCall = 0;
	}

}